//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System.Collections.Generic;

using Mindscape.BackgroundMotion.Core.Model;

namespace Mindscape.BackgroundMotion.Core.Search
{
  /// <summary>
  /// The contract which all search providers must implement
  /// </summary>
  public interface ISearchEngine
  {
    /// <summary>
    /// Searches the index based on the specified query.
    /// </summary>
    /// <param name="query">The query.</param>
    /// <param name="pageSize">Size of the page.</param>
    /// <param name="page">The page.</param>
    /// <param name="totalResults">The total results.</param>
    /// <returns></returns>
    IList<T> Search<T>(string query, int pageSize, int page, out int totalResults) where T : IIndexable;

    /// <summary>
    /// Indexes the specified item.
    /// </summary>
    /// <param name="item">The item.</param>
    void Index(IIndexable item);

    /// <summary>
    /// Removes the specified item from the index.
    /// </summary>
    /// <param name="item">The item.</param>
    void Remove(IIdentifiable item);

    /// <summary>
    /// Rebuilds the index.
    /// </summary>
    void RebuildIndex<T>() where T : IIndexable;
  }
}